package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.VResultsContactApplication;
import com.ruoyi.system.service.IVResultsContactApplicationService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 问题数据查询Controller
 * 
 * @author ruoyi
 * @date 2024-12-14
 */
@Controller
@RequestMapping("/system/VResultsContactApplication")
public class VResultsContactApplicationController extends BaseController
{
    private String prefix = "system/VResultsContactApplication";

    @Autowired
    private IVResultsContactApplicationService vResultsContactApplicationService;

    @RequiresPermissions("system:VResultsContactApplication:view")
    @GetMapping()
    public String VResultsContactApplication()
    {
        return prefix + "/VResultsContactApplication";
    }

    /**
     * 查询问题数据查询列表
     */
    @RequiresPermissions("system:VResultsContactApplication:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(VResultsContactApplication vResultsContactApplication)
    {
        startPage();
        List<VResultsContactApplication> list = vResultsContactApplicationService.selectVResultsContactApplicationList(vResultsContactApplication);
        return getDataTable(list);
    }

    /**
     * 导出问题数据查询列表
     */
    @RequiresPermissions("system:VResultsContactApplication:export")
    @Log(title = "问题数据查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(VResultsContactApplication vResultsContactApplication)
    {
        List<VResultsContactApplication> list = vResultsContactApplicationService.selectVResultsContactApplicationList(vResultsContactApplication);
        ExcelUtil<VResultsContactApplication> util = new ExcelUtil<VResultsContactApplication>(VResultsContactApplication.class);
        return util.exportExcel(list, "问题数据查询数据");
    }

    /**
     * 新增问题数据查询
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存问题数据查询
     */
    @RequiresPermissions("system:VResultsContactApplication:add")
    @Log(title = "问题数据查询", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(VResultsContactApplication vResultsContactApplication)
    {
        return toAjax(vResultsContactApplicationService.insertVResultsContactApplication(vResultsContactApplication));
    }

    /**
     * 修改问题数据查询
     */
    @RequiresPermissions("system:VResultsContactApplication:edit")
    @GetMapping("/edit/{courseId}")
    public String edit(@PathVariable("courseId") Long courseId, ModelMap mmap)
    {
        VResultsContactApplication vResultsContactApplication = vResultsContactApplicationService.selectVResultsContactApplicationByCourseId(courseId);
        mmap.put("vResultsContactApplication", vResultsContactApplication);
        return prefix + "/edit";
    }

    /**
     * 修改保存问题数据查询
     */
    @RequiresPermissions("system:VResultsContactApplication:edit")
    @Log(title = "问题数据查询", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(VResultsContactApplication vResultsContactApplication)
    {
        return toAjax(vResultsContactApplicationService.updateVResultsContactApplication(vResultsContactApplication));
    }

    /**
     * 删除问题数据查询
     */
    @RequiresPermissions("system:VResultsContactApplication:remove")
    @Log(title = "问题数据查询", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(vResultsContactApplicationService.deleteVResultsContactApplicationByCourseIds(ids));
    }
}
